﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Resources;
using System.Text;
using System.Windows.Forms;

namespace myAlarm
{
    public partial class CloseBox : Form
    {
        public CloseBox()
        {
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                FileInfo myFile = new FileInfo(Properties.Resources.ResourcesPath);
                if (!Directory.Exists(myFile.DirectoryName)) Directory.CreateDirectory(myFile.DirectoryName);
                ResourceWriter rw = new ResourceWriter(Properties.Resources.ResourcesPath);
                string CloseType = "0";
                if (this.rbtnMini.Checked) CloseType = "1";
                if (this.rbtnExit.Checked) CloseType = "2";
                rw.AddResource("CloseType", CloseType);
                rw.Generate();
                rw.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
